refactor(operator-trend): absorb reset_reentry tier into the recovery base (T3-2 phase 6e)#86
Merged
Conversation
… base (T3-2 phase 6e) The recovery base (#85) parametrized the rebuild + rererestore refresh-recovery tiers. The shallower reset_reentry tier is a structural clone of that same algorithm (same signature, same control flow; it only differs in its per-tier reset/freshness keys, its rebuild-tier status vocabulary, reason prose, and output keys). Add a _RESET_REENTRY_RECOVERY_SPEC and make closure_forecast_reset_reentry_refresh_recovery_for_target a thin wrapper -- a third tier on one base. The spec was extracted by a paired structural AST traversal of base-vs-tier (which also proves structural identity: the traversal aligns every node, recording the literal wherever the base reads spec.X). Public signature unchanged. Net -200 lines. Note: the reset_refresh recovery tier is NOT absorbed -- it takes target_class_key instead of ordered_events, so it is a genuinely different shape, not a clone. Verified: paired-traversal structural identity + composer golden byte-identical to main + full suite (2539 passed). ruff + mypy clean.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
The recovery base (#85) already serves the
rebuild+rererestorerefresh-recovery tiers. This absorbs a third tier — the shallowerreset_reentryrecovery — onto the same_recovery_for_target_base.closure_forecast_reset_reentry_refresh_recovery_for_target(258 lines) is a structural clone of the base algorithm: same signature, same control flow, differing only in its per-tier reset/freshness keys, its rebuild-tier status vocabulary (rebuilding-/rebuilt-/pending-…-rebuild), reason prose, and output keys. Add_RESET_REENTRY_RECOVERY_SPEC; the function becomes a thin wrapper.−200 net lines.
How the spec was derived (and proven)
A paired structural AST traversal walks the base and the real function in lockstep. Wherever the base reads
spec.X, the aligned node in the real function is recorded as that field's value. The traversal completing at all is the proof of structural identity — every other node aligns exactly. Then the composer golden is byte-identical tomainand the full suite passes.Scope note
The
reset_refreshrecovery tier is not absorbed — it takestarget_class_keyinstead ofordered_events, so it's a genuinely different shape, not a clone. Shallower tiers need a per-tier clone check, not a blanket spec-add; this PR does that check and absorbs only the one that qualifies.Verification
main; full suite2539 passedruff+mypyclean; public signature unchanged